package com.santu.edu.supporter.biz.school.dao;

import com.santu.edu.supporter.biz.school.dao.mapper.SchoolMapper;
import com.santu.edu.supporter.biz.school.pojo.dto.SchoolDTO;
import com.santu.edu.supporter.biz.school.pojo.po.SchoolPO;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author luoyaoqi
 * @createTime 2024/2/21
 * @description
 */
@Repository
@RequiredArgsConstructor
public class SchoolDao {

    private final SchoolMapper schoolMapper;

    public void addSchool(SchoolDTO dto) {
        SchoolPO item = SchoolPO.createItem(dto);
        schoolMapper.insertOne(item);
    }

    public List<SchoolDTO> getSchoolIdByName(String schoolName) {
        return schoolMapper.selectSchoolIdByName(schoolName);
    }

    public SchoolDTO getSchoolById(String schoolId) {
        return schoolMapper.selectSchoolById(schoolId);
    }
}
